"""
龟兔赛跑
"""
import turtle
from random import randint

p = turtle.Pen()    # 创建画笔

p.speed(10)  # 控制绘画速度
p.penup()  # 将提起笔，移动时无图
p.goto(-140, 140)  # 设置画笔起点位置

# 画14条竖线
for step in range(15):
    p.write(step, align='center')
    p.right(90)
    # 画虚线
    for num in range(8):
        p.penup()
        p.forward(10)
        p.pendown()
        p.forward(10)
    p.penup()
    p.backward(160)
    p.left(90)
    p.forward(20)

# 选手就位
ada = turtle.Turtle()
ada.color('red')
ada.shape('turtle')
ada.penup()
ada.goto(-160, 100)
ada.pendown()   # 放下笔，移动的时候绘图
# 旋转360
for turn in range(10):
    ada.right(36)

bob = turtle.Turtle()
bob.color('blue')
bob.shape('turtle')
bob.penup()
bob.goto(-160, 70)
bob.pendown()
# 旋转360
for turn in range(72):
    bob.left(5)


foo = turtle.Turtle()
foo.color('green')
foo.shape('turtle')
foo.penup()
foo.goto(-160, 40)
foo.pendown()
# 旋转360
for turn in range(60):
    foo.right(6)

ann = turtle.Turtle()
ann.color('orange')
ann.shape('turtle')
ann.penup()
ann.goto(-160, 10)
ann.pendown()
# 旋转360
for turn in range(30):
    ann.left(12)

for turn in range(100):
    ada.forward(randint(1, 5))
    bob.forward(randint(1, 5))
    foo.forward(randint(1, 5))
    ann.forward(randint(1, 5))
